#include<bits/stdc++.h>
using namespace std;
#define int long long

int n, k;
int a[100];
int flag, ans = 0x3f3f3f3f;

void dfs(int now, int t){
	if(now == n){
		ans = min(ans, t);
		return ;
	}
	dfs(now+1, t+a[now]);
	if(!flag){
		flag = 1;
		now += k;
		dfs(min(now, n), t);
		now -= k;
		flag = 0;
	}
}

signed main(){
	cin >> n >> k;
	for(int i = 1; i < n; i++)
		cin >> a[i];
	dfs(1, 0);
	cout << ans;
	return 0;
}
